<template>

  <div style="padding: 10px;">
    <el-row >
      <el-col>
        <div style="display: flex;">
          <div>
            <el-form :model="list_params" ref="searchForm"  size="small" :inline="true">
              <el-form-item label="" label-width="80px" prop="contractNumber">
                <el-input v-model="list_params.contractNumber" placeholder="合同号/货柜号搜索" ></el-input>
              </el-form-item>
              <el-form-item label="销售日期" prop="saleDate">
                <el-date-picker
                  v-model="list_params.saleDate"
                  type="date" value-format="yyyy-MM-dd"
                  placeholder="选择日期">
                </el-date-picker>
              </el-form-item>
              <el-form-item>
                <el-button type="primary"  size="mini" @click="handleQuery">搜索</el-button>
                <el-button  size="mini" @click="resetQuery">重置</el-button>
              </el-form-item>
            </el-form>
          </div>
          <div style="flex: 1;"></div>
                    <div>
<!--                      <el-button>删除</el-button>-->
<!--                      <el-button @click="handleEnable(0)" >禁用</el-button>-->
<!--                      <el-button @click="handleEnable(1)" >启用</el-button>-->
<!--                      <el-button @click="handleExport">导出</el-button>-->
<!--                      <el-button>导入</el-button>-->
                      <el-button type="primary" @click="addInfo" v-hasPermi="['xnf:sale_list:add']" >新增</el-button>
                    </div>
        </div>
      </el-col>
      <el-col>
        <div style="margin-top: 10px;">
          <el-table :data="list_data" @selection-change="handleSelectionChange"  :height="table_height" style="width: 100%;" >
            <el-table-column type="selection" width="50" align="center"  />
            <el-table-column label="销售单号" prop="saleListNumber"></el-table-column>
            <el-table-column label="销售日期" prop="saleDate"></el-table-column>
            <el-table-column label="代卖到货单" prop="containerNumber"></el-table-column>
            <el-table-column label="合同号" prop="contractNumber"></el-table-column>
            <el-table-column label="货柜号" prop="containerNumber"></el-table-column>
            <el-table-column label="销售总金额(元)" prop="amt"></el-table-column>
            <el-table-column label="销售数量" prop="saleCnt"></el-table-column>
            <el-table-column label="销售重量(KG)" prop="weight"></el-table-column>
            <el-table-column label="状态" prop="handleStatus">
              <template slot-scope="scope">
                {{scope.row.handleStatus == 1?'已销售':'已撤销'}}
              </template>
            </el-table-column>
            <el-table-column label="创建时间" prop="createTime"></el-table-column>
            <el-table-column label="操作" prop="cargoOwnerName" fixed="right">
              <template slot-scope="scope" >
                <el-button
                  size="mini"
                  type="text"
                  @click="showInfo(scope.row)"
                >查看详情</el-button>
              </template>
            </el-table-column>
          </el-table>

          <pagination
            v-show="list_total>0"
            :total="list_total"
            :page.sync="list_params.pageNum"
            :limit.sync="list_params.pageSize"
            @pagination="getList"
          />
        </div>
      </el-col>
    </el-row>
    <el-drawer title="新增代卖销售单" size="80%" :visible.sync="dialog_show">
      <el-form  ref="form"  size="small" :inline="true">
        <div>
          <div class="section">
            <el-row>
              <el-col :span="6" >
                <el-form-item label="代卖到货单" prop="agencySellingListId">
                  <el-select filterable  placeholder="请选择" v-model="form_data.agencySellingListId" :style="{width: '100%'}" @change="onOrderChange" filterable>
                    <el-option v-for="item in selling_list" :label="item.contractNumber +' - '+item.containerNumber" :value="item.id"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6" >
                <el-form-item label="销售日期" prop="saleDate">
                  <el-date-picker v-model="form_data.saleDate" type="date" placeholder="选择日期" style="width: 100%;"></el-date-picker>
                </el-form-item>
              </el-col>
              <el-col>
                <div>销售明细</div>
              </el-col>
              <el-col>
                <el-table :data="order_product_list" show-summary :summary-method="getSummaries">
                  <el-table-column label="序号" >
                    <template slot-scope="scope">
                    {{ scope.$index + 1 }}
                    </template>
                  </el-table-column>
                  <el-table-column label="产品" prop="productName" >
<!--                    <template slot-scope="scope">-->
<!--                      <el-select filterable  placeholder="请选择" :style="{width: '100%'}" v-model="order_product_list[scope.$index].productId">-->
<!--                        <el-option v-for="item in order_products" :label="item.productName" :value="item.productId"></el-option>-->
<!--                      </el-select>-->
<!--                    </template>-->
                  </el-table-column>
                  <el-table-column label="规格" prop="specificationName">
<!--                    <template slot-scope="scope">-->
<!--                      <el-select filterable  placeholder="请选择" :style="{width: '100%'}" v-model="order_product_list[scope.$index].specificationId">-->
<!--                        <el-option v-for="item in spec_list" :label="item.name" :value="item.id"></el-option>-->
<!--                      </el-select>-->
<!--                    </template>-->

                  </el-table-column>
                  <el-table-column prop="surplusCnt" label="剩余数量"></el-table-column>
                  <el-table-column label="销售数量" prop="saleCnt" >
                    <template slot-scope="scope">
                      <el-input v-model="order_product_list[scope.$index].saleCnt" type="number" :max="scope.row.surplusCnt" @blur="onSaleCntChange(scope.$index,scope.row)"></el-input>
                    </template>
                  </el-table-column>
                  <el-table-column label="箱规(KG/件)" prop="boxSpecificationWeight" >
                  </el-table-column>
                  <el-table-column label="重量(KG)" prop="weight" >
<!--                    <template slot-scope="scope">-->
<!--                      <div v-if="order_product_list[scope.$index].saleCnt == ''">-</div>-->
<!--                      <div v-else>{{ order_product_list[scope.$index].boxSpecificationWeight * order_product_list[scope.$index].saleCnt }}</div>-->
<!--                    </template>-->
                  </el-table-column>
                  <el-table-column label="销售单价" prop="unitPrice" >
                    <template slot-scope="scope">
                      <el-input  type="number" v-model="order_product_list[scope.$index].unitPrice" @blur="onSaleCntChange(scope.$index,scope.row)" ></el-input>
                    </template>
                  </el-table-column>
                  <el-table-column label="销售金额" prop="saleAmt" >
                    <template slot-scope="scope">
                      <el-input type="number"  v-model="order_product_list[scope.$index].saleAmt"></el-input>
                    </template>
                  </el-table-column>
                  <el-table-column label="备注" prop="remark" >
                    <template slot-scope="scope">
                      <el-input v-model="order_product_list[scope.$index].remark"></el-input>
                    </template>
                  </el-table-column>
                  <el-table-column label="操作" prop="cargoOwnerName" fixed="right">
                    <template slot-scope="scope">
                      <el-button
                        size="mini"
                        type="text"
                        v-if="scope.$index!=0"
                        @click="delProduct(scope.row,scope.$index)"
                      >删除</el-button>
                      <el-button
                        size="mini"
                        type="text"
                        @click="addProduct(scope.row,scope.$index)"
                      >新增</el-button>
                    </template>
                  </el-table-column>
                </el-table>
              </el-col>
            </el-row>
          </div>
          <div class="section">
            <div style="padding-bottom: 12px;">代卖垫付费用</div>
            <div>
              <el-table :data="fees" style="width: 100%" >
                <el-table-column prop="date" label="序号">
                  <template slot-scope="scope" >
                    {{ scope.$index + 1 }}
                  </template>
                </el-table-column>
                <el-table-column prop="date" label="科目">
                  <template slot-scope="scope" >
                    <el-select filterable  v-model="fees[scope.$index].financeSubjectId" filterable>
                      <el-option v-for="fee in subject_list" :key="fee.id" :label="fee.name" :value="fee.id" ></el-option>
                    </el-select>
                  </template>
                </el-table-column>
                <el-table-column prop="date" label="金额">
                  <template slot-scope="scope" >
                    <el-input v-model="fees[scope.$index].amt" type="number"></el-input>
                  </template>
                </el-table-column>
                <el-table-column prop="date" label="备注">
                  <template slot-scope="scope" >
                    <el-input v-model="fees[scope.$index].remark"></el-input>
                  </template>
                </el-table-column>
                <el-table-column prop="date" label="操作">
                  <template slot-scope="scope" >
                    <el-button
                      size="mini"
                      type="text"
                      v-if="scope.$index!=0"
                      @click="delFee(scope.$index)"
                    >删除</el-button>
                    <el-button
                      size="mini"
                      type="text"
                      @click="addFee(scope.row)"
                    >新增</el-button>
                  </template>
                </el-table-column>
              </el-table>
            </div>
          </div>
          <div class="section">
            <div style="padding-bottom: 12px;">其他费用</div>
            <div>
              <el-table :data="other_fees" style="width: 100%" >
                <el-table-column prop="date" label="序号">
                  <template slot-scope="scope" >
                    {{ scope.$index + 1 }}
                  </template>
                </el-table-column>
                <el-table-column prop="date" label="科目">
                  <template slot-scope="scope" >
                    <el-select filterable  v-model="other_fees[scope.$index].financeSubjectId" filterable>
                      <el-option v-for="fee in subject_list" :key="fee.id" :label="fee.name" :value="fee.id" ></el-option>
                    </el-select>
                  </template>
                </el-table-column>
                <el-table-column prop="date" label="金额">
                  <template slot-scope="scope" >
                    <el-input type="number" v-model="other_fees[scope.$index].amt"></el-input>
                  </template>
                </el-table-column>
                <el-table-column prop="date" label="备注">
                  <template slot-scope="scope" >
                    <el-input v-model="other_fees[scope.$index].remark"></el-input>
                  </template>
                </el-table-column>
                <el-table-column prop="date" label="操作">
                  <template slot-scope="scope" >
                    <el-button
                      size="mini"
                      type="text"
                      v-if="scope.$index!=0"
                      @click="delOtherFee(scope.$index)"
                    >删除</el-button>
                    <el-button
                      size="mini"
                      type="text"
                      @click="addOtherFee(scope.row)"
                    >新增</el-button>
                  </template>
                </el-table-column>
              </el-table>
            </div>
          </div>
          <div class="section" style="display: flex;justify-content: flex-end;position: sticky;bottom: 0px;">
            <el-button type="primary" @click="submitData">提交</el-button>
          </div>
        </div>
      </el-form>
    </el-drawer>
    <el-drawer
      title="代卖销售详情"
      size="80%"
      :visible.sync="edit_dialog_show">
      <div>
        <div class="section">
          <el-row>
            <el-col :span="4" class="section-item">
              <div class="section-item-title">销售单号</div>
              <div>{{ info.saleListNumber	 }}</div>
            </el-col>
            <el-col :span="4" class="section-item">
              <div class="section-item-title">销售日期</div>
              <div>{{ info.saleDate	 }}</div>
            </el-col>
            <el-col :span="4" class="section-item">
              <div class="section-item-title">状态</div>
              <div>{{ info.handleStatus == 1?'已销售':'已撤销' }}</div>
            </el-col>
          </el-row>
        </div>
        <div class="section">
          <div style="padding-bottom: 12px;">产品明细</div>
          <div>
            <el-table :data="sale_products" show-summary :summary-method="getSummaries1">
              <el-table-column label="序号">
                <template slot-scope="scope" >
                  {{ scope.$index + 1 }}
                </template>
              </el-table-column>
              <el-table-column label="产品" prop="productName" >
              </el-table-column>
              <el-table-column label="规格" prop="specificationName">
              </el-table-column>
              <el-table-column label="提货数量" prop="saleCnt" >
              </el-table-column>
              <el-table-column label="箱规(KG/件)" prop="boxSpecificationWeight" >
              </el-table-column>
              <el-table-column label="重量(KG)" prop="weight" >
              </el-table-column>
              <el-table-column label="销售单价" prop="unitPrice" >
              </el-table-column>
              <el-table-column label="销售金额" prop="saleAmt" >
              </el-table-column>
              <el-table-column label="备注" prop="remark" >
              </el-table-column>
            </el-table>
          </div>
        </div>
        <div class="section">
          <div style="padding-bottom: 12px;">代卖垫付费用</div>
          <div>
            <el-table :data="sale_fees" show-summary>
              <el-table-column label="序号">
                <template slot-scope="scope" >
                  {{ scope.$index + 1 }}
                </template>
              </el-table-column>
              <el-table-column label="科目" prop="financeSubjectName"></el-table-column>
              <el-table-column label="金额" prop="amt"></el-table-column>
              <el-table-column label="备注" prop="remark"></el-table-column>
            </el-table>
          </div>
        </div>
        <div class="section">
          <div style="padding-bottom: 12px;">其他费用</div>
          <div>
            <el-table :data="sale_other_fees" show-summary>
              <el-table-column label="序号">
                <template slot-scope="scope" >
                  {{ scope.$index + 1 }}
                </template>
              </el-table-column>
              <el-table-column label="科目" prop="financeSubjectName"></el-table-column>
              <el-table-column label="金额" prop="amt"></el-table-column>
              <el-table-column label="备注" prop="remark"></el-table-column>
            </el-table>
          </div>
        </div>
        
          <div class="section" v-if="info.handleStatus == 1" style="display: flex;justify-content: flex-end;position: sticky;bottom: 0px;">
            <el-button type="danger" @click="cancelOrder">撤销</el-button>
          </div>
<!--        <div class="section">-->
<!--          <el-tabs>-->
<!--            <el-tab-pane label="变更记录">-->
<!--              <el-timeline >-->
<!--                <el-timeline-item color="#14BC8F"-->
<!--                                  v-for="(activity, index) in activities"-->
<!--                                  :key="index"-->
<!--                                  :timestamp="activity.timestamp">-->
<!--                  {{activity.content}}-->
<!--                </el-timeline-item>-->
<!--              </el-timeline>-->
<!--            </el-tab-pane>-->
<!--          </el-tabs>-->
<!--        </div>-->
      </div>
    </el-drawer>

    <el-dialog :visible.sync="chooseProductDialog" title="产品选择" >
      <el-table :data="choose_products" @selection-change="handleProductSelectionChange" >
        <el-table-column type="selection" width="50" align="center"  />
        <el-table-column label="产品" prop="productName" >
        </el-table-column>
        <el-table-column label="规格" prop="specificationName">
        </el-table-column>
        <el-table-column prop="cnt" label="装柜数量"></el-table-column>
        <el-table-column label="提货数量" prop="saleCnt" >
          <template slot-scope="scope">
            <el-input  v-model="scope.row.saleCnt" type="number" :max="scope.row.cnt" @blur="onSaleCntChange(scope.$index,scope.row)"></el-input>
          </template>
        </el-table-column>
        <el-table-column label="箱规(KG/件)" prop="boxSpecificationWeight" >
        </el-table-column>
        <el-table-column label="重量(KG)" prop="weight" >
        </el-table-column>
        <el-table-column label="单价" prop="unitPrice" >
          <template slot-scope="scope">
            <el-input type="number" v-model="scope.row.unitPrice" @blur="onSaleCntChange(scope.$index,scope.row)"></el-input>
          </template>
        </el-table-column>
        <el-table-column label="金额" prop="saleAmt" >
          <template slot-scope="scope">
            <el-input v-model="scope.row.saleAmt" type="number"></el-input>
          </template>
        </el-table-column>
      </el-table>

      <div slot="footer" class="dialog-footer">
        <el-button @click="chooseProductDialog = false">取 消</el-button>
        <el-button type="primary"@click="confirmProducts">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {add,list,detail,getSaleProductList,cancelOrder} from '@/api/sell/sale_list'
import {list as subjectList} from '@/api/base/subject'
import {list as sellingList,getProductList } from '@/api/agency/selling'
import { list as productList} from '@/api/product/info'
import { list as feeList } from "@/api/fee/fee";
import {list as specList} from '@/api/product/spec'
export default {
  name: 'sea_transportation',
  data() {
    return {
      list_params:{
        contractNumber:'',
        pageSize:10,
        pageNum:1,
      },
      sale_other_fees:[],
      sale_fees:[],
      sale_products:[],
      choose_products:[],
      selected_products:[],
      info:{},
      chooseProductDialog:false,
      table_height:window.innerHeight - 300,
      dialog_show : false,
      edit_dialog_show : false,
      fees:[{ financeSubjectId:'' }],
      subject_list:[],
      other_fees:[{ financeSubjectId:'' }],
      selling_list:[],
      order_product_list:[],
      order_products:[],
      product_list:[],
      spec_list:[],
      activities: [{
        content: '活动按期开始',
        timestamp: '2018-04-15'
      }, {
        content: '通过审核',
        timestamp: '2018-04-13'
      }, {
        content: '创建成功',
        timestamp: '2018-04-11'
      }],
      form_data:{},
      supplyListId:'',
      list_total:0,
      list_data:[]
    }
  },
  created() {
    this.getSubjectList()
    this.getSellingList()
    this.getAllProductList()
    this.getSpecList()
    this.getList()
  },
  methods: {

    getList(){
      let params = {
        ...this.list_params,
        manageType: 1,
      }
      list(params).then(res => {
        console.log(res)
        this.list_data =  res.rows;
        this.list_total = res.total
      })
    },
    addFee(row){
      this.fees.push({ financeSubjectId:'' })
    },
    delFee(row){
      this.fees.splice(row,1)
    },
    addOtherFee(row){
      this.other_fees.push({ financeSubjectId:'' })
    },
    delOtherFee(row){
      this.other_fees.splice(row,1)
    },
    getSpecList(){
      specList({is_page:0}).then(res => {
        console.log(res)
        this.spec_list =  res.rows;
      })
    },
    getAllProductList(){
      productList({is_page:0}).then(res => {
        console.log(res)
        this.product_list =  res.rows;
      })
    },
    getSellingList(){
      sellingList({is_page:0}).then(res => {
        console.log(res)
        this.selling_list =  res.rows;
      })
    },
    getSubjectList(){
      subjectList({is_page:0}).then(res => {
        console.log(res)
        this.subject_list =  res.rows;
      })
    },
    handleQuery() {
      this.getList()
    },
    resetQuery(){
      this.list_params = {
        ...this.list_params,
        pageNum:1,
        contractNumber:'',
        saleDate:''
      }
      this.getList()
    },
    showInfo(info){
      this.edit_dialog_show = true
      detail(info.id).then(res => {
        console.log(res)
        this.info = res.data;
        this.form_data = res.data;
        this.loadSaleProductList();
        this.loadSaleFees()
      })
    },
    loadSaleFees(){
      let params = {
        saleListId:this.info.id,
        supplyListId:this.info.supplyListId,
        bizType:5,is_page:0
      }
      let params_other = {
        saleListId:this.info.id,
        supplyListId:this.info.supplyListId,
        bizType:6,is_page:0
      }
      feeList(params).then(res => {
        console.log(res)
        this.sale_fees = res.rows;
      })
      feeList(params_other).then(res => {
        console.log(res)
        this.sale_other_fees = res.rows;
      })
    },
    loadSaleProductList(){
      let params = {
        saleListId:this.info.id,is_page:0
      }
      getSaleProductList(params).then(res => {
        this.sale_products = res.rows
      })
    },
    addInfo(){
      this.dialog_show = true
    },
    onOrderChange(e){
      let supplyListId = this.selling_list.filter(item => item.id == e)[0].supplyListId
      this.supplyListId = supplyListId
      getProductList(e).then(res => {
        console.log(res)
        this.order_product_list = res.rows
        this.order_products = JSON.parse(JSON.stringify(res.rows))
      })
    },
    onSaleCntChange(index,row){
      if (row.saleCnt > row.surplusCnt){
        row.saleCnt = row.surplusCnt
      }
      let weight = row.boxSpecificationWeight*row.saleCnt
      let saleAmt = row.unitPrice * weight;
      this.$set(row,'weight',weight);
      this.$set(row,'saleAmt',saleAmt);
    },
    onUnitPriceChange(index){
      let saleCnt = this.order_product_list[index].saleCnt
      let unitPrice = this.order_product_list[index].unitPrice
      let order_product_list = this.order_product_list
      order_product_list[index].saleAmt = saleCnt * unitPrice
      this.order_product_list = order_product_list
      console.log('销售单价'+unitPrice)
      console.log('销售数量'+saleCnt)
      console.log(order_product_list[index])
      console.log('-----------------')
      // this.order_product_list[index].saleAmt = saleCnt * unitPrice
    },
    submitData(){
      console.log(this.order_product_list)
      console.log(this.fees)
      console.log(this.other_fees)
      console.log(this.form_data)
      let fees = this.fees;
      let other_fees = this.other_fees;
      let arr = [];
      for (let i = 0; i < fees.length; i++) {
        if (fees[i].financeSubjectId && fees[i].amt) {
          fees[i].bizType = 5;
          arr.push(fees[i]);
        }
      }
      for (let i = 0; i < other_fees.length; i++) {
        if (other_fees[i].financeSubjectId && other_fees[i].amt) {
          other_fees[i].bizType = 6;
          arr.push(other_fees[i]);
        }
      }

      let order_product_list = this.order_product_list;

      let saleAmt,saleWeight = 0;
      ``
      let xnfSaleProductDetailList= [];
      for (let i = 0; i < order_product_list.length; i++) {

        if (!order_product_list[i].saleCnt){
          this.$message.error('请填写'+order_product_list[i]['productName']+'['+order_product_list[i]['specificationName']+']'+'提货数量')
          return;
        }
        if (!order_product_list[i].unitPrice){
          this.$message.error('请填写'+order_product_list[i]['productName']+'['+order_product_list[i]['specificationName']+']'+'单价')
          return;
        }
        if (!order_product_list[i].saleAmt){
          this.$message.error('请填写'+order_product_list[i]['productName']+'['+order_product_list[i]['specificationName']+']'+'金额')
          return;
        }
        saleAmt+=parseFloat(order_product_list[i].saleAmt)
        saleWeight+=parseFloat(order_product_list[i].weight)
        let product = {
          ...order_product_list[i],
          agencySellingProductId:order_product_list[i].id,
          id:undefined
        }
        xnfSaleProductDetailList.push(product)
      }
      let form_data = {
        ...this.form_data,
        xnfFeeList:arr,
        xnfSaleProductDetailList:xnfSaleProductDetailList,
        supplyListId:this.supplyListId,
        enable:1,
        manageType:1
      }

      console.log(form_data)
      add(form_data).then(res => {
        console.log(res)
        this.dialog_show = false
        this.getList()
      })
    },
    onPaymentRoleChange(e){
      if (e == 3){
        stallList({is_page:0}).then(res=>{
          this.payment_roles = res.rows
        })
      }else{
        customerList({is_page:0}).then(res=>{
          this.payment_roles = res.rows
        })
      }
    },
    addProduct(e,index){
      console.log(this.order_products.length)
      console.log(this.order_product_list.length)
      let arr = [];
      for (let i = 0;i < this.order_products.length; i++){
        let flag = true;
        for (let j = 0;j < this.order_product_list.length; j++){
          if (this.order_products[i].id == this.order_product_list[j].id){
            flag = false;
          }
        }
        if (flag){
          arr.push(this.order_products[i])
        }
      }
      this.choose_products = arr;
      this.chooseProductDialog = true;
    },
    delProduct(e,index){
      this.order_product_list.splice(index,1)
    },
    handleProductSelectionChange(selection){
      console.log(selection)
      this.selected_products = selection;
    },

    confirmProducts(){
      this.chooseProductDialog = false;
      this.order_product_list = this.order_product_list.concat(this.selected_products);

    },
    getSummaries(param){
      const { columns, data } = param;
      const sums = [];
      columns.forEach((column, index) => {
        if (index === 0) {
          sums[index] = '合计';
          return;
        }else if(index === 4 || index === 6 || index === 8){
          const values = data.map(item => Number(item[column.property]));
          if (!values.every(value => isNaN(value))) {
            sums[index] = values.reduce((prev, curr) => {
              const value = Number(curr);
              if (!isNaN(value)) {
                return prev + curr;
              } else {
                return prev;
              }
            }, 0);
          }
        }
      })

      return sums;
    },
    getSummaries1(param){
      const { columns, data } = param;
      const sums = [];
      columns.forEach((column, index) => {
        if (index === 0) {
          sums[index] = '合计';
          return;
        }else if(index === 3 || index === 5 || index === 7){
          const values = data.map(item => Number(item[column.property]));
          if (!values.every(value => isNaN(value))) {
            sums[index] = values.reduce((prev, curr) => {
              const value = Number(curr);
              if (!isNaN(value)) {
                return prev + curr;
              } else {
                return prev;
              }
            }, 0);
          }
        }
      })

      return sums;
    },
    cancelOrder(){
      this.$confirm('确定撤销销售单吗？', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        cancelOrder({id:this.info.id}).then(res => {
          this.$message({
            type: 'success',
            message: '销售单撤销成功'
          });
          this.getList()
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消销售单撤销操作'
        });
      });
    }
  }
}
</script>

<style scoped>

</style>

<style scoped>
.section{
  background: #fff;
  padding: 24px;
//padding-bottom: 6px;
  margin: 20px;
  border-radius: 8px;
}
.section-item{
  margin: 10px 0px;
  height: 52px;
}
.section-item-title{
  padding-bottom: 10px;
  font-size: 14px;
}
</style>

<style>

.el-drawer__body{
  background: #F3F4F6;
}
.select-custom-icon .el-input__suffix {
  display: none; /* 隐藏默认的下拉箭头 */
}
.select-custom-icon .el-input__suffix::after {
  content: url('../../../assets/icons/more.png'); /* 替换为您的自定义图标路径 */
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
}
.popper-class{
  display: none;
}

</style>
